package com.siqi.hr.system.custom.utils;

import com.siqi.hr.system.custom.entity.EntityOperation;
import org.apache.commons.lang.StringUtils;

/**
 * 处理实体操作工具类
 * @author     xiaogq
 * Created by xiaogoingqin on 2016/8/9
 */
public class EntityOperationUtils {
    /**
     * 处理操作类型方法(xiaogq)
     * @param operationType        操作类型(0:添加table标签，1：弹窗，2：url跳转)
     * @return
     */
    public static String getOperationType(int operationType) {
        String str = "";
        switch (operationType){
            case 0 :
                str = "添加标签";
                break;
            case 1 :
                str = "弹窗";
                break;
            case 2 :
                str = "URL跳转";
                break;
            default:
                str = "其他";
        }
        return str;
    }

    /**
     * 处理按钮显示在哪里方法(xiaogq)
     * @param operation        操作按钮显示在哪里 0:显示在列前，1：显示在列表上，2：显示在查看页面，其他地方可以添加
     * @return
     */
    public static String getButtonShowHere(EntityOperation operation) {
        String str = "";
        boolean showList = operation.getShowList();
        boolean showColumn = operation.getShowColumn();
        boolean showView = operation.getShowView();
        if (showList){
            str += "列表,";
        }
        if(showColumn){
            str += "列前,";
        }
        if (showView){
            str += "详情页,";
        }
        if(StringUtils.isNotBlank(str)){
            str = str.substring(0,str.length()-1);
        }
        return str;
    }

}
